<template>
  <div class="h100 sysLogPage">
    <div class="sysLogSearch table-page-search-wrapper">
      <sysLog-search @clickbtn="handleClickSearchBtn"></sysLog-search>
    </div>
    <div class="sysLogMain">
      <sysLog-table-list ref="sysLogMainComp" @clickbtn="handleMainCompClick"></sysLog-table-list>
    </div>
  </div>
</template>
<script>
import SysLogSearch from './components/SysLogSearch.vue'
import SysLogTableList from './components/SysLogTableList.vue'
import { mapState, mapGetters } from 'vuex'

export default {
  components: {
    SysLogSearch,
    SysLogTableList
  },
  computed: {
    ...mapGetters(['myActiveProjectId'])
  },
  data () {
    return {
      nowTime: 156789
    }
  },
  created () {
    this.getPageDictData()
  },
  methods: {
    handleClickSearchBtn (data) {
      this.nowTime = new Date().getTime()
      if (this[data.type]) {
        this[data.type](data)
      }
    },
    handleMainCompClick (data) {
      this.nowTime = new Date().getTime()
      if (this[data.type]) {
        this[data.type](data.data)
      }
    },
    searchData (isToFirstPage) {
      this.$refs.sysLogMainComp.refreshData(isToFirstPage)
    },
    getPageDictData () {
      ['getSystemLogTypeDictCodeData'].forEach(method => {
        this.$store.dispatch(method)
      })
    }
  },
  beforeDestroy () {
    this.$store.commit('resetSysDataLogQueryParams')
  }
}
</script>
<style lang="less" scoped>
@import url('./style/list.less');
</style>
